home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2407 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: eua.ericsson.se!usenet
  2. From: euahjn@eua.ericsson.se (Henrik Johansson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Get name of current method, class or function automatically?
  5. Date: 17 Jan 1996 17:16:31 GMT
  6. Organization: Ericsson Telecom Systems Labs, Stockholm, Sweden
  7. Distribution: world
  8. Message-ID: <4djatf$rh9@euas20.eua.ericsson.se>
  9. References: <4dhaoq$f6l@sunsystem5.informatik.tu-muenchen.de>
  10. Reply-To: euahjn@eua.ericsson.se
  11. NNTP-Posting-Host: euas31i2c37.eua.ericsson.se
  12. NNTP-Posting-User: euahjn
  13.  
  14. In article <4dhaoq$f6l@sunsystem5.informatik.tu-muenchen.de>, Peter Breitling <breitlip@informatik.tu-muenchen.de> writes:
  15. > I want to write some debugging functions for my library:
  16. > i have the problem that i want to pass debugging information along with the
  17. > name of the method, the linenumber and the file.
  18. > The macros __FILE__ and __LINE__ are standard C(++). Is there something
  19. > similar- like __FUNCTION__ or __METHOD__ or __CLASS__ in the scope of the
  20. > function, method or class?
  21. > Is such thing planned in future?
  22. > If not - why? I think such things would be very useful. Or is there any
  23. > workaround?
  24.  
  25. I agree about the usefullness of such a thing, but I understand why
  26. it is not possible today: C/C++ preprocessors does not understand C syntax,
  27. they just scans for their own preprocessor instructions. A C preprocessor
  28. can't tell if its inside a function, let alone tell its name. A __FUNCTION__
  29. `macro' can not be a preprocessor macro because of that.
  30.  
  31. However, the C/C++ syntax itself could be changed to include the proper tokens
  32. and translate them to the proper character constants. Very useful IMO.
  33.  
  34.  
  35.